﻿<UserControl x:Class="OIManager.Views.SetupAppsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:df="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="6" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <!--MASTER LIST OF DATASETS-->
        <ListBox Name="Items" Grid.Column="0" Grid.Row="0" 
                 Height="550" Width="480" Margin="4"
                 SelectedItem="{Binding Item, Mode=TwoWay}"
                 VerticalAlignment="Top">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Title}" Style="{StaticResource ListItems}" />
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <!--DETAILS-->
        <df:DataForm x:Name="DetailsForm" Grid.Column="1" Grid.Row="0"
                     ItemsSource="{Binding Items}" AutoGenerateFields="False"
                     CurrentItem="{Binding Item, Mode=TwoWay}"
                     CommandButtonsVisibility="Edit,Cancel,Commit,Navigation"
                     DescriptionViewerPosition="BesideLabel"
                     AutoEdit="False"
                     HorizontalAlignment="Left" VerticalAlignment="Top"
                     Height="550" Width="480" Margin="4">

            <df:DataForm.EditTemplate>
                <DataTemplate>
                    <StackPanel>
                        <df:DataField Label="App Title">
                            <TextBox Text="{Binding Title, Mode=TwoWay, ValidatesOnDataErrors=True}" />
                        </df:DataField>

                        <df:DataField Label="Description">
                            <TextBox Text="{Binding Description, Mode=TwoWay}" TextWrapping="Wrap" Height="96"/>
                        </df:DataField>

                        <df:DataField Label="Share ID (GUID)">
                            <TextBox Text="{Binding ShareID, Mode=TwoWay, Converter={StaticResource GuidToStringConverter}, ValidatesOnDataErrors=True}" />
                        </df:DataField>

                        <df:DataField Label="Thumbnail URI">
                            <TextBox Text="{Binding ThumbnailURI, Mode=TwoWay}" />
                        </df:DataField>

                        <df:DataField Label="Custom App URI Override">
                            <TextBox Text="{Binding UriOverride, Mode=TwoWay}" />
                        </df:DataField>
                    </StackPanel>
                </DataTemplate>
            </df:DataForm.EditTemplate>
        </df:DataForm>

        <!--SEP-->
        <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Background="#08000000" Margin="24,2,24,2"/>

        <!--BUTTONS-->
        <StackPanel Orientation="Horizontal" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="4">
            <Button x:Name="AddApp" Content="Add App" Width="120" Margin="0,0,8,0" />
            <Button x:Name="RemApp" Content="Remove App" Width="120" Margin="0,0,8,0" />
        </StackPanel>

    </Grid>
</UserControl>
